<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      #box {
        font-size: 10px;
      }
      #box::before {
        content: "hello jack";
        font-size: 50px;
      }
    </style>
  </head>
  <body>
    <div id="box" style="color: red">hello box</div>
    <script>
      const box = document.getElementById("box");
      console.log(box.style.fontSize);
      // 最终计算结果
      console.log(getComputedStyle(box).fontSize);
      console.log(getComputedStyle(box).color);

      console.log(getComputedStyle(box, "before").color);
      console.log(getComputedStyle(box, "before").fontSize);
    </script>
  </body>
</html>
